package com.zyz.K_集合.Collections;

import java.util.ArrayList;
import java.util.Collections;

/**
 * @author: vick
 * @Date: 2025/3/31
 * @Description:
 * @version: 1.0
 */
public class PokerTest {
    public static void main(String[] args) {
        ArrayList<String> poker = new ArrayList<>();
        //方块，梅花，红桃， 黑桃
        String[] color = {"♦","♣","♥","♠"};
        String[] num = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};

        //生成54张牌
        for (String s1 : color) {
            for (String s2 : num) {
                poker.add(s1.concat(s2));
            }
        }
        poker.add("小王");
        poker.add("大王");
        //洗牌
        Collections.shuffle(poker);
        System.out.println(poker);
        //发牌
        ArrayList tomCards = new ArrayList();
        ArrayList jerryCards = new ArrayList();
        ArrayList vickCards = new ArrayList();
        ArrayList lastCards = new ArrayList();
        for (int i = 0; i < poker.size(); i++) {
            if (i >= poker.size() - 3) { //最后3张底牌
                lastCards.add(poker.get(i));
            } else if (i % 3 == 0) {
                tomCards.add(poker.get(i));
            }else if (i % 3 == 1) {
                jerryCards.add(poker.get(i));
            }else {
                vickCards.add(poker.get(i));
            }
        }

        System.out.println(tomCards);
        System.out.println(jerryCards);
        System.out.println(vickCards);
        System.out.println(lastCards);
    }
}
